<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var str = "我来搞前端，oh，yeah！";
      console.log(str);
      //unicode编码处理 对英文字母和符号不进行编码
      console.log(encodeURIComponent(str));
      var s = encodeURIComponent(str);
      console.log(s);
      //unicode解码
      console.log(decodeURIComponent(encodeURIComponent(str)));
      console.log(decodeURIComponent(s));
    </script>
  </body>
</html>
